package com.example.springboot004extensionpoint.applicationListener;

import com.example.springboot004extensionpoint.bootstrapRegistryInitializer.User;
import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;

public class StartingEventApplicationListener implements ApplicationListener<ApplicationStartingEvent> {

    @Override
    public void onApplicationEvent(ApplicationStartingEvent event) {
        System.out.println("KoalaCustom *** StartingEventApplicationListener");
        BootstrapRegistry.InstanceSupplier<User> u1 = event.getBootstrapContext().getRegisteredInstanceSupplier(User.class);
        System.out.println(u1.get(event.getBootstrapContext()).getName());

    }
}
